<template>
    <view class="versions_box">
        <view class="versions">
            <!-- <image :src="'https://oos-cn.ctyunapi.cn/front-end/static/static/' + sellerNo + '.png'" class="logo"></image> -->
            <image :src="appIcon" class="logo"></image>

            <view class="vertest">{{ version }}</view>
            <view class="list">
                <view class="set-list" @tap="goUserAgreement">
                    <view>服务协议</view>
                    <view>
                        <image src="https://oos-cn.ctyunapi.cn/front-end/static/mine/images/back.png"></image>
                    </view>
                </view>
                <view class="set-list" @tap="goPrivacyPolicy">
                    <view style="border-bottom: none">隐私政策</view>
                    <view style="border-bottom: none">
                        <image src="https://oos-cn.ctyunapi.cn/front-end/static/mine/images/back.png"></image>
                    </view>
                </view>
                <!-- #ifdef APP-PLUS -->
                <view class="beian" hover-class="hoverClass" @longtap="longtap" @click="toB">ICP备案号：{{ recordNum }}</view>
                <!--  #endif -->
            </view>
        </view>

        <view class="record_number" v-if="mobilePlatformFilingDesc">
            <view class="text_box">
                ICP备案编号: <text @click="toNumberLink()">{{ mobilePlatformFilingDesc }}</text>
            </view>
        </view>

    </view>

</template>

<script>
'use strict'; // mine/pages/versions/versions.ts

var app = getApp();

var util_1 = require("../../../utils/util");
export default {
    data() {
        return {
            appIcon: '',
            sellerNo: '',
            version: 'v' + app.globalData.appVersion,
            recordNum: app.globalData.recordNum,

            mobilePlatformFilingDesc: uni.getStorageSync('mobilePlatformFilingDesc'),
            mobilePlatformFilingLink: uni.getStorageSync('mobilePlatformFilingLink'),
        };
    }
    /**
     * 生命周期函数--监听页面加载
     */,
    onLoad: function () {
        this.setData({
            sellerNo: app.globalData.sellerNo
        });
    },
    /**
     * 生命周期函数--监听页面显示
     */
    onShow: function () {
        // #ifdef MP-WEIXIN
        let wxInfo = __wxConfig.accountInfo;
        console.log(wxInfo, 'wx小程序Info...')
        this.setData({
            appIcon: wxInfo.icon // 微信公众平台或微信开放平台上为小程序设置的基本资料中的图标
        })
        // #endif
		
		// #ifdef MP-ALIPAY
		// const accountInfo = my.getAccountInfoSync();
		// console.log("支付宝Info----",accountInfo.miniProgram); // 小程序信息
		console.log("支付宝Info----",app.globalData); // 小程序信息
		this.setData({
		    // appIcon: "https://appstoreisvpic.alipayobjects.com/prod/821d4fd7-97f7-4a83-8676-3093800262ca.png"
			appIcon: app.globalData.baseConfig.mobilePlatformLogo
		})
		// #endif

        // #ifdef APP-PLUS
        this.setData({
            appIcon: 'https://oos-cn.ctyunapi.cn/front-end/static/static/' + app.globalData.sellerNo + '.png'
        })
        // #endif
    },
    methods: {
        toB() {
            uni.navigateTo({
                url: `/pages/webViewPage/webViewPage?src=${encodeURI('https://beian.miit.gov.cn')}`
            })
        },
        longtap() {
            uni.setClipboardData({
                data: this.recordNum,
                success: () =>
                    uni.showToast({
                        title: '备案号已复制'
                    })
            })
        },
        // 用户使用协议
        goUserAgreement: function () {
            if (this.sellerNo == 'lp') {
                uni.navigateTo({
                    url: '/agreement/pages/userAgreement/userAgreement-lp'
                });
            } else {
                uni.navigateTo({
                    url: '/agreement/pages/userAgreement/userAgreement'
                });
            }
        },

        // 隐私政策
        goPrivacyPolicy: function () {
            if (this.sellerNo == 'lp') {
                uni.navigateTo({
                    url: '/agreement/pages/privacyPolicy/privacyPolicy-lp'
                });
            } else {
                uni.navigateTo({
                    url: '/agreement/pages/privacyPolicy/privacyPolicy'
                });
            }
        },

        // ICP备案 跳转
        toNumberLink() {
            let linkMallUrl = this.mobilePlatformFilingLink
            console.log('toNumberLink====>', linkMallUrl)

            app.globalData.CHECK_LOGIN(() => {
                util_1.LinkType(linkMallUrl);
            })
        },
        
    }
};
</script>
<style lang="less">
@import url('./versions.less');
</style>
